namespace SmartSoft.ADP
{
    using System;
    using System.Data;
    using System.Data.SqlClient;

    public class PriceCalculateDataAccess
    {
        private WSPriceCalculateDataAccess.WSPriceCalculateDataAccess wDataAcess = new WSPriceCalculateDataAccess.WSPriceCalculateDataAccess();
        private SmartSoft.DAL.PriceCalculateDataAccess oDataAcess = new SmartSoft.DAL.PriceCalculateDataAccess();

        public PriceCalculateDataAccess()
        {
            wDataAcess.Url = wDataAcess.Url.Replace("localhost", AdapterInstance.ServerIp);
        }

        public void Calculate0(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Kho, object ps_Ma_Vt)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                wDataAcess.Calculate0(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Kho, ps_Ma_Vt);
            }
            else
            {
                oDataAcess.Calculate0(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Kho, ps_Ma_Vt);
            }
        }

        public void Calculate1(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Kho, object ps_Ma_Vt)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                wDataAcess.Calculate1(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Kho, ps_Ma_Vt);
            }
            else
            {
                oDataAcess.Calculate1(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Kho, ps_Ma_Vt);
            }
        }
        public void Calculate2(string ps_Subsidiary, object pd_Ngay_Ct1, object pd_Ngay_Ct2, object ps_Ma_Kho, object ps_Ma_Vt)
        {
            if (AdapterInstance.IsRemoteConnected)
            {
                wDataAcess.Calculate2(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Kho, ps_Ma_Vt);
            }
            else
            {
                oDataAcess.Calculate2(ps_Subsidiary, pd_Ngay_Ct1, pd_Ngay_Ct2, ps_Ma_Kho, ps_Ma_Vt);
            }
        }

    }
}